<!DOCTYPE HTML>
<html>
<head>
<#include "WEB-INF/view/_frag/meta.ftl">
<#include "WEB-INF/view/_frag/jscss.ftl">
<title>添加账号</title>
</head>
<body>
<article class="page-container">
	<form id="form-add" class="form form-horizontal">
		<input type="hidden" name="ask" value="${ask}"/>
		<input type="hidden" name="systemUser.id" value="${systemUser.id}"/>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>登录名：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text"   placeholder="" id="name" name="systemUser.login_name" value="${systemUser.login_name}">
			</div>
		</div>	 
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>真实姓名：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" name="systemUser.real_name" value="${systemUser.real_name}">
			</div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>性别：</label>
			<div class="formControls col-xs-8 col-sm-6">
				<span class="select-box" style="width:130px">
					<select class="select valid" size="1" name="systemUser.sex" aria-required="true" aria-invalid="false" style="width:120px">
						<option value="-1">请选择</option>
						<#list page.sexs as sexs>
							<#if systemUser.sex == sexs.c_key>
								<option value="${sexs.c_key}" selected="selected">${sexs.c_value}</option>
							<#else>
								<option value="${sexs.c_key}">${sexs.c_value}</option>
							</#if>
						</#list>
					</select>
				</span>
				<small class="text-danger">${error_role}</small>
			</div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>手机号码：</label>
			<div class="formControls col-xs-8 col-sm-6">
				<input type="text" class="input-text" name="systemUser.mobile" value="${systemUser.mobile}">
			</div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">密码：</label>
			<div class="formControls col-xs-8 col-sm-9">
				 默认密码123456，登录后可自行更改密码。
			</div>
		</div>
		
		
		<!--  
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">密码：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="password" class="input-text" id="password" name="member.password" value="" placeholder="重置密码需要填写">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3">确认密码：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="password" class="input-text" name="confirmpassword" value="" placeholder="重置密码需要填写">
			</div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>角色：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<span class="select-box" style="width:130px">
					<select class="select valid" size="1" name="member.role_id" aria-required="true" aria-invalid="false" style="width:120px">
						<option value="-1">请选择</option>
						<#list page.role as data>
						<#if member.role_id == data.role_id>
						<option value="${data.role_id}" selected="selected">${data.role_name}</option>
						<#else>
						<option value="${data.role_id}">${data.role_name}</option>
						</#if>
						</#list>
					</select>
				</span>
				<small class="text-danger">${error_role}</small>
			</div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>是否删除：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<span class="select-box" style="width:130px">
					<select class="select valid" size="1" name="member.deleted" aria-required="true" aria-invalid="false" style="width:120px">
						<#if member.deleted == 0>
						<option value="0" selected="selected">否</option>
						<#else>
						<option value="0">否</option>
						</#if>
						<#if member.deleted == 1>
						<option value="1" selected="selected">是</option>
						<#else>
						<option value="1">是</option>
						</#if>
					</select>
				</span>
				<small class="text-danger">${error_role}</small>
			</div>
		</div>
-->
		
		<div class="row cl">
			<div class="text-r col-xs-2 col-sm-2 col-xs-offset-4 col-sm-offset-4">
				<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
			<div class="text-l col-xs-2 col-sm-2">
				<a class="btn btn-default" href="${basePath}/systemUser/list"><span class="glyphicon glyphicon-arrow-left"></span> 返回</a>
			</div>
		</div>
	</form>
</article>

<script type="text/javascript">
	$(function(){
		$('.skin-minimal input').iCheck({
			checkboxClass: 'icheckbox-blue',
			radioClass: 'iradio-blue',
			increaseArea: '20%'
		});
		
		$("#form-add").validate({
			rules:{
				'systemUser.login_name':{
					required:true,
					minlength:2,
					maxlength:16
				},
				'systemUser.real_name':{
					required:true,
					minlength:2,
					maxlength:16
				},
				/* 'member.password':{
					minlength:6,
					maxlength:22
				},
				confirmpassword:{
			        equalTo: "#password"
				}, */
			},
			onkeyup:false,
//			focusCleanup:true,
			success:"valid",
			submitHandler:function(form){
				$(form).ajaxSubmit({
					type: 'post',
					url: "${basePath}/systemUser/ajaxCheckMemberValue" ,
					success: function(data){
//						layer.msg('添加成功!',{icon:1,time:1000});
						if (data == 0) {//成功
		                	window.location.href = "list";
		                } else if (data == 1) {
		                	layer.alert("请指定角色名。", { icon: 0 });
		                } else {
		                	layer.alert("登录名已存在，请重新指定。", { icon: 0 });
		                }
					},
	                error: function(XmlHttpRequest, textStatus, errorThrown){
						layer.msg('error!',{icon:1,time:1000});
					}
				});
			}
		});
	});

</script> 
<!--/请在上方写此页面业务相关的脚本-->
 
</body>
</html>